package com.health.viewscontrols.lvyuejl;

import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Spinner;
import android.widget.TextView;

import com.health.R;
import com.health.adapter.SpinnerAdapter;
import com.health.model.LvYueFuWuBean;
import com.health.tablebean.ARCHIVE_BASEINFO;
import com.health.tools.ImageTools;
import com.health.viewscontrols.NovaActivity;
import com.health.widget.EditTextWithDate;

import java.text.SimpleDateFormat;


/**
 * 展示履约服务
 * Created by John on 2019/3/5.
 */

public class ShowLvYueActivity extends NovaActivity {


    TextView xuetang_spinner;//血糖下拉
    TextView lvyueJiBing;//现存主要疾病
    TextView lvyueJiBing_beizhu;
    TextView lvyuejkgy_beizhu;
    TextView lvyuezyqk_beizhu;
    TextView lvyueYongyao;//用药情况
    TextView yongYao_beizhu;
    TextView zhuanzhen_beizhu;

    TextView docname_beizhu;
    TextView username_beizhu;

    TextView beiZhu1;//备注1
    TextView beiZhu2;//备注2
    TextView beiZhu3;//备注3

    //口唇
    RadioGroup group_kouchun;
    RadioButton kouchun_hongrun;
    RadioButton kouchun_cangbai;
    RadioButton kouchun_fangan;
    TextView kouchun_qita;
    TextView kouchun_beizhu;
    //齿列
    CheckBox chilie_zhengchuang;
    CheckBox chilie_quechi;
    CheckBox chilie_yuchi;
    CheckBox chilie_yichi;
    TextView chilie_qita;
    TextView chilie_beizhu;

    //咽部
    CheckBox yanbu_wuchongxue;
    CheckBox yanbu_chongxue;
    CheckBox yanbu_linba;
    TextView yanbu_qita;
    TextView yanbu_beizhu;
    //听力
    RadioGroup group_tingli;
    RadioButton tingli_yes;
    RadioButton tingli_no;
    TextView tingli_qita;
    TextView tingli_beizhu;
    //皮肤
    RadioGroup group_pifu;
    RadioButton pifu_zhengchang;
    RadioButton pifu_chaoshi;
    RadioButton pifu_cangbai;
    RadioButton pifu_fagan;
    RadioButton pifu_huangran;
    TextView pifu_qita;
    TextView pifu_beizhu;
    //肺心率
    RadioGroup group_fei_xinlv;
    RadioButton xinlv_qi;
    RadioButton xinlv_buqi;
    RadioButton xinlv_jueduibuqi;
    TextView fei_xinlv_qita;
    TextView fei_xinlv_beizhu;
    //杂音
    RadioGroup group_zayin;
    RadioButton zayin_no;
    RadioButton zayin_yes;
    TextView zayin_qita;
    TextView zayin_beizhu;
    //压痛
    RadioGroup group_yatong;
    RadioButton yatong_no;
    RadioButton yatong_yes;
    TextView yatong_qita;
    TextView yatong_beizhu;
    //包块
    RadioGroup group_baokuai;
    RadioButton baokuai_no;
    RadioButton baokuai_yes;
    TextView baokuai_qita;
    TextView baokuai_beizhu;
    //肝大
    RadioGroup group_ganda;
    RadioButton ganda_no;
    RadioButton ganda_yes;
    TextView ganda_qita;
    TextView ganda_beizhu;
    //脾大
    RadioGroup group_pida;
    RadioButton pida_no;
    RadioButton pida_yes;
    TextView pida_qita;
    TextView pida_beizhu;
    //浊音
    RadioGroup group_zhuoyin;
    RadioButton zhuoyin_no;
    RadioButton zhuoyin_yes;
    TextView zhuoyin_qita;
    TextView zhuoyin_beizhu;
    Button btn_back;//返回
    TextView title;//标题


    TextView ed_date;//服务时间
    TextView lvyue_name;//姓名
    TextView lvYue_age;//年龄

    TextView lvyueHight;//身高
    TextView lvyueWeight;//体重

    TextView lvyueTzzs;//体质指数
    TextView lvyueHuxi;//呼吸频率
    TextView lvyueXinlv;//心率
    TextView lvyueTiwen;//体温
    TextView lvyueXueYaGao;//收缩压
    TextView lvyueXueYaDi;//舒张压
    TextView lvyueXueTang;//血糖
    TextView lvyueJkgl;//健康管理
    TextView lvyueZyqk;//住院情况
    TextView lvyueZzqk;//转诊情况
    TextView lvyuedocName;//医生姓名
    ImageView lvyueDocImg;

    TextView lvyueHuanName;//患者姓名
    ImageView lvyueHuanImg;

    TextView lvyueBeiZhu;//备注
    LvYueFuWuBean lvYueFuWuBean;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_show_lvyue);
        lvYueFuWuBean=(LvYueFuWuBean) getIntent().getSerializableExtra("LvYueBean");
        findViews();
        setData();
        setListeners();

    }

    @Override
    public void findViews() {
        btn_back=findViewById(R.id.btn_back);
        title=findViewById(R.id.title);
        title.setText("履约服务记录表");

        ed_date=findViewById(R.id.ed_date);
        lvyue_name=findViewById(R.id.lvyue_name);
        lvYue_age=findViewById(R.id.lvyue_age);

        lvyueHight=findViewById(R.id.lvyue_hight);
        lvyueWeight=findViewById(R.id.lvyue_weight);
        lvyueTzzs=findViewById(R.id.lvyue_tzzs);
        lvyueHuxi=findViewById(R.id.lvyue_huxi);
        lvyueXinlv=findViewById(R.id.lvyue_xinlv);

        lvyueTiwen=findViewById(R.id.lvyue_tiwen);
        lvyueXueYaGao=findViewById(R.id.lvyue_xueya_gao);
        lvyueXueYaDi=findViewById(R.id.lvyue_xueya_di);
//        lvyueXueTang=findViewById(R.id.lvyue_xuetang);
        lvyueJkgl=findViewById(R.id.lvyue_jkgl);
        lvyueZyqk=findViewById(R.id.lvyue_zyqk);
        lvyueZzqk=findViewById(R.id.lvyue_zzqk);
        lvyuedocName=findViewById(R.id.lvyue_docname);
        lvyueDocImg=findViewById(R.id.img_doctorsign);
        lvyueDocImg.setVisibility(View.VISIBLE);
        lvyueHuanName=findViewById(R.id.lvyue_juming_name);
        lvyueHuanImg=findViewById(R.id.img_patientsign);
        lvyueHuanImg.setVisibility(View.VISIBLE);
        lvyueBeiZhu=findViewById(R.id.lvyue_beizhu);










        lvyueXueTang=findViewById(R.id.lvyue_xuetang);
        xuetang_spinner=findViewById(R.id.xuetang_spinner);

        lvyueJiBing=findViewById(R.id.lvyue_jibing);
        lvyueJiBing_beizhu=findViewById(R.id.jibing_beizhu);
        lvyuejkgy_beizhu=findViewById(R.id.jkgl_beizhu);
        lvyuezyqk_beizhu=findViewById(R.id.zhuyuan_beizhu);
        lvyueYongyao=findViewById(R.id.lvyue_yongyao);
        yongYao_beizhu=findViewById(R.id.yongyao_beizhu);

        zhuanzhen_beizhu=findViewById(R.id.zhuanzhen_beizhu);
        docname_beizhu=findViewById(R.id.doc_beizhu);
        username_beizhu=findViewById(R.id.user_beizhu);

        beiZhu1=findViewById(R.id.lvyue_beizhu1);
        beiZhu2=findViewById(R.id.lvyue_beizhu2);
        beiZhu3=findViewById(R.id.lvyue_beizhu3);

        //口唇
        group_kouchun=findViewById(R.id.group_kouchun);
        kouchun_hongrun=findViewById(R.id.kouchun_hongrui);
        kouchun_cangbai=findViewById(R.id.kouchun_cangbai);
        kouchun_fangan=findViewById(R.id.kouchun_fagan);
        kouchun_qita=findViewById(R.id.kouchun_qita);
        kouchun_beizhu=findViewById(R.id.kouchun_beizhu);

        //齿列
        chilie_zhengchuang=findViewById(R.id.chilie_zhengchang);
        chilie_quechi=findViewById(R.id.chilie_quechi);
        chilie_yuchi=findViewById(R.id.chilie_yuchi);
        chilie_yichi=findViewById(R.id.chilie_yichi);
        chilie_qita=findViewById(R.id.chile_qita);
        chilie_beizhu=findViewById(R.id.chile_beizhu);
        //咽部
        yanbu_wuchongxue=findViewById(R.id.yanbu_wuchongxue);
        yanbu_chongxue=findViewById(R.id.yanbu_chongxue);
        yanbu_linba=findViewById(R.id.yanbu_zengsheng);
        yanbu_qita=findViewById(R.id.yanbu_qita);
        yanbu_beizhu=findViewById(R.id.yanbu_beizhu);
        //听力
        group_tingli=findViewById(R.id.group_tingli);
        tingli_yes=findViewById(R.id.tingli_yes);
        tingli_no=findViewById(R.id.tingli_no);
        tingli_qita=findViewById(R.id.tingli_qita);
        tingli_beizhu=findViewById(R.id.tingli_beizhu);
        //皮肤
        group_pifu=findViewById(R.id.group_pifu);
        pifu_zhengchang=findViewById(R.id.pifu_zhengchang);
        pifu_chaoshi=findViewById(R.id.pifu_chaoshi);
        pifu_cangbai=findViewById(R.id.pifu_cangbai);
        pifu_fagan=findViewById(R.id.pifu_fagan);
        pifu_huangran=findViewById(R.id.pifu_huangran);
        pifu_qita=findViewById(R.id.pifu_qita);
        pifu_beizhu=findViewById(R.id.pifu_beizhu);
        //肺心率
        group_fei_xinlv=findViewById(R.id.group_xinlv);
        xinlv_qi=findViewById(R.id.xinlv_qi);
        xinlv_buqi=findViewById(R.id.xinlv_buqi);
        xinlv_jueduibuqi=findViewById(R.id.xinlv_jueduibuqi);
        fei_xinlv_qita=findViewById(R.id.xinlv_qita);
        fei_xinlv_beizhu=findViewById(R.id.xinlv_beizhu);
        //杂音
        group_zayin=findViewById(R.id.group_zayin);
        zayin_no=findViewById(R.id.zayin_no);
        zayin_yes=findViewById(R.id.zayin_yes);
        zayin_qita=findViewById(R.id.zayin_qita);
        zayin_beizhu=findViewById(R.id.zayin_beizhu);
        //压痛
        group_yatong=findViewById(R.id.group_yatong);
        yatong_no=findViewById(R.id.yatong_no);
        yatong_yes=findViewById(R.id.yatong_yes);
        yatong_qita=findViewById(R.id.yatong_qita);
        yatong_beizhu=findViewById(R.id.yatong_beizhu);
        //包块
        group_baokuai=findViewById(R.id.group_baokuai);
        baokuai_no=findViewById(R.id.baokuai_no);
        baokuai_yes=findViewById(R.id.baokuai_yes);
        baokuai_qita=findViewById(R.id.baokuai_qita);
        baokuai_beizhu=findViewById(R.id.baokuai_beizhu);
        //肝大
        group_ganda=findViewById(R.id.group_ganda);
        ganda_no=findViewById(R.id.ganda_no);
        ganda_yes=findViewById(R.id.ganda_yes);
        ganda_qita=findViewById(R.id.ganda_qita);
        ganda_beizhu=findViewById(R.id.ganda_beizhu);
        //脾大
        group_pida=findViewById(R.id.group_pida);
        pida_no=findViewById(R.id.pida_no);
        pida_yes=findViewById(R.id.pida_yes);
        pida_qita=findViewById(R.id.pida_qita);
        pida_beizhu=findViewById(R.id.pida_beizhu);
        //浊音
        group_zhuoyin=findViewById(R.id.group_zhuoyin);
        zhuoyin_no=findViewById(R.id.zhuoyin_no);
        zhuoyin_yes=findViewById(R.id.zhuoyin_yes);
        zhuoyin_qita=findViewById(R.id.zhuoyin_qita);
        zhuoyin_beizhu=findViewById(R.id.zhuoyin_beizhu);
    }

    public void setData(){
        if(lvYueFuWuBean!=null){
            ed_date.setText(lvYueFuWuBean.getLvyueDate());
            lvyue_name.setText(lvYueFuWuBean.getName());
            lvYue_age.setText(lvYueFuWuBean.getAge());
            lvyueHight.setText(lvYueFuWuBean.getHight());
            lvyueWeight.setText(lvYueFuWuBean.getWeight());
            lvyueTzzs.setText(lvYueFuWuBean.getTzzs());
            lvyueHuxi.setText(lvYueFuWuBean.getHuxi());
            lvyueXinlv.setText(lvYueFuWuBean.getXinlv());
            lvyueTiwen.setText(lvYueFuWuBean.getTiWen());
            lvyueXueYaGao.setText(lvYueFuWuBean.getXueyaGao());
            lvyueXueYaDi.setText(lvYueFuWuBean.getXueyaDi());
            lvyueXueTang.setText(lvYueFuWuBean.getXueTang());
            lvyueJkgl.setText(lvYueFuWuBean.getJkgl());
            lvyueZyqk.setText(lvYueFuWuBean.getZyqk());
            lvyueZzqk.setText(lvYueFuWuBean.getZzqk());
            lvyuedocName.setText(lvYueFuWuBean.getDocName());
            lvyueHuanName.setText(lvYueFuWuBean.getName());
            lvyueDocImg.setImageBitmap(ImageTools.getLoacalBitmap(lvYueFuWuBean.getDocQianMingStr()));
            lvyueHuanImg.setImageBitmap(ImageTools.getLoacalBitmap(lvYueFuWuBean.getHuanQianMingStr()));
            lvyueBeiZhu.setText(lvYueFuWuBean.getBeiZhu());
            beiZhu1.setText(lvYueFuWuBean.getBeiZhu1());
            beiZhu2.setText(lvYueFuWuBean.getBeiZhu2());
            beiZhu3.setText(lvYueFuWuBean.getBeiZhu3());
            if("1".equals(lvYueFuWuBean.getXueTangType())){
                xuetang_spinner.setText("空腹血糖");
            }else if("2".equals(lvYueFuWuBean.getXueTangType())){
                xuetang_spinner.setText("餐后1小时血糖");
            }else if("3".equals(lvYueFuWuBean.getXueTangType())){
                xuetang_spinner.setText("餐后2小时血糖");
            }else if("4".equals(lvYueFuWuBean.getXueTangType())){
                xuetang_spinner.setText("随机血糖");
            }
            if("1".equals(lvYueFuWuBean.getKouchun())){
                kouchun_hongrun.setChecked(true);
            }else if("2".equals(lvYueFuWuBean.getKouchun())){
                kouchun_cangbai.setChecked(true);
            }else if("3".equals(lvYueFuWuBean.getKouchun())){
                kouchun_fangan.setChecked(true);
            }
            kouchun_qita.setText(lvYueFuWuBean.getKouchun_qita());
            kouchun_beizhu.setText(lvYueFuWuBean.getKouchun_beizhu());
           if("1".equals(lvYueFuWuBean.getChilie())){
                chilie_zhengchuang.setChecked(true);
                chilie_quechi.setChecked(false);
                chilie_yuchi.setChecked(false);
                chilie_yichi.setChecked(false);
           }

           if(lvYueFuWuBean.getChilie()!=null&&lvYueFuWuBean.getChilie().contains("2")){
               chilie_quechi.setChecked(true);
           }
           if(lvYueFuWuBean.getChilie()!=null&&lvYueFuWuBean.getChilie().contains("3")){
                chilie_yuchi.setChecked(true);
           }
            if(lvYueFuWuBean.getChilie()!=null&&lvYueFuWuBean.getChilie().contains("4")){
                chilie_yichi.setChecked(true);
            }
            chilie_qita.setText(lvYueFuWuBean.getChilie_qita());
            chilie_beizhu.setText(lvYueFuWuBean.getChilie_beizhu());

            if("1".equals(lvYueFuWuBean.getYanbu())){
                yanbu_wuchongxue.setChecked(true);
                yanbu_chongxue.setChecked(false);
                yanbu_linba.setChecked(false);
            }
            if(lvYueFuWuBean.getYanbu()!=null&&lvYueFuWuBean.getYanbu().contains("2")){
                yanbu_chongxue.setChecked(true);
            }
            if(lvYueFuWuBean.getYanbu()!=null&&lvYueFuWuBean.getYanbu().contains("3")){
                yanbu_linba.setChecked(true);
            }
            yanbu_qita.setText(lvYueFuWuBean.getYanbu_qita());
            yanbu_beizhu.setText(lvYueFuWuBean.getYanbu_beizhu());

            if("1".equals(lvYueFuWuBean.getTingli())){
                tingli_yes.setChecked(true);
            }else if("2".equals(lvYueFuWuBean.getTingli())){
                tingli_no.setChecked(true);
            }
            tingli_qita.setText(lvYueFuWuBean.getTingli_qita());
            tingli_beizhu.setText(lvYueFuWuBean.getTingli_beizhu());

            if("1".equals(lvYueFuWuBean.getPifu())){
                pifu_zhengchang.setChecked(true);
            }else if("2".equals(lvYueFuWuBean.getPifu())){
                pifu_chaoshi.setChecked(true);
            }else if("3".equals(lvYueFuWuBean.getPifu())){
                pifu_chaoshi.setChecked(true);
            }else if("4".equals(lvYueFuWuBean.getPifu())){
                pifu_fagan.setChecked(true);
            }else if("5".equals(lvYueFuWuBean.getPifu())){
                pifu_huangran.setChecked(true);
            }
            pifu_qita.setText(lvYueFuWuBean.getPifu_qita());
            pifu_beizhu.setText(lvYueFuWuBean.getPifu_beizhu());

            if("1".equals(lvYueFuWuBean.getFei_xinlv())){
                xinlv_qi.setChecked(true);
            }else if("2".equals(lvYueFuWuBean.getFei_xinlv())){
                xinlv_buqi.setChecked(true);
            }else if("3".equals(lvYueFuWuBean.getFei_xinlv())){
                xinlv_jueduibuqi.setChecked(true);
            }
            fei_xinlv_qita.setText(lvYueFuWuBean.getFei_xinlv_qita());
            fei_xinlv_beizhu.setText(lvYueFuWuBean.getFei_xinlv_beizhu());

            if("1".equals(lvYueFuWuBean.getZayin())){
                zayin_no.setChecked(true);
            }else if("2".equals(lvYueFuWuBean.getZayin())){
                zayin_yes.setChecked(true);
            }
            zayin_qita.setText(lvYueFuWuBean.getZayin_qita());
            zayin_beizhu.setText(lvYueFuWuBean.getZayin_beizhu());
            if("1".equals(lvYueFuWuBean.getYatong())){
                yatong_no.setChecked(true);
            }else if("2".equals(lvYueFuWuBean.getYatong())){
                yatong_yes.setChecked(true);
            }
            yatong_qita.setText(lvYueFuWuBean.getYatong_qita());
            yatong_beizhu.setText(lvYueFuWuBean.getYatong_beizhu());

            if("1".equals(lvYueFuWuBean.getBaokuai())){
                baokuai_no.setChecked(true);
            }else if("2".equals(lvYueFuWuBean.getBaokuai())){
                baokuai_yes.setChecked(true);
            }
            baokuai_qita.setText(lvYueFuWuBean.getBaokuai_qita());
            baokuai_beizhu.setText(lvYueFuWuBean.getBaokuai_beizhu());

            if("1".equals(lvYueFuWuBean.getGanda())){
                ganda_no.setChecked(true);
            }else if("2".equals(lvYueFuWuBean.getGanda())){
                ganda_yes.setChecked(true);
            }
            ganda_qita.setText(lvYueFuWuBean.getGanda_qita());
            ganda_beizhu.setText(lvYueFuWuBean.getGanda_beizhu());

            if("1".equals(lvYueFuWuBean.getPida())){
                pida_no.setChecked(true);
            }else if("2".equals(lvYueFuWuBean.getPida())){
                pida_yes.setChecked(true);
            }
            pida_qita.setText(lvYueFuWuBean.getPida_qita());
            pida_beizhu.setText(lvYueFuWuBean.getPida_beizhu());


            if("1".equals(lvYueFuWuBean.getZhuoyin())){
                zhuoyin_no.setChecked(true);
            }else if("2".equals(lvYueFuWuBean.getZhuoyin())){
                zhuoyin_yes.setChecked(true);
            }
            zhuoyin_qita.setText(lvYueFuWuBean.getZhuoyin_qita());
            zhuoyin_beizhu.setText(lvYueFuWuBean.getZhuoyin_beizhu());
            lvyueJiBing.setText(lvYueFuWuBean.getJiBing());
            lvyueJiBing_beizhu.setText(lvYueFuWuBean.getJibing_beizhu());
            lvyuejkgy_beizhu.setText(lvYueFuWuBean.getJkgy_beizhu());
            lvyuezyqk_beizhu.setText(lvYueFuWuBean.getZyqk_beizhu());
            lvyueYongyao.setText(lvYueFuWuBean.getYongyao());
            yongYao_beizhu.setText(lvYueFuWuBean.getYongyao_beizhu());
            zhuanzhen_beizhu.setText(lvYueFuWuBean.getZzqk_beizhu());
            docname_beizhu.setText(lvYueFuWuBean.getDocName_beizhu());
            username_beizhu.setText(lvYueFuWuBean.getUserName_beizhu());




        }

    }

    @Override
    public void setListeners() {
        btn_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
}
